package com.app.config;
import com.app.util.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author by jt
 * 全局异常处理
 */
@RestControllerAdvice
public class exceptionConfig {
   private static  final Logger logger= LoggerFactory.getLogger(exceptionConfig.class);


    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Result exception(Exception e){
       logger.info(e.getMessage());
       return Result.fail(500);
   }

}
